﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using System.Linq;
using System.Collections.Generic;
using PMSGSC.DAL;
using System.Windows.Forms;
using System.IO;
namespace PMSGSC.App.Report
{
    public partial class rpWorkComplete : DevExpress.XtraReports.UI.XtraReport
    {
        public rpWorkComplete(List<Department> dataSource)
        {
            InitializeComponent();

            xrLabel33.Text = DateTime.Now.Date.ToString("MM/dd/yyyy");
            bindingSource1.DataSource = dataSource;
            OpenDocument();
        }
        private void OpenDocument()
        {
            string Address = Application.StartupPath + "\\Attachment\\";
            Directory.CreateDirectory(Address);
            if (null != bindingSource1.DataSource)
            {
                try
                {
                    Department department = bindingSource1.Cast<Department>().ToList()[0];
                    string fileName = department.Ship.NameShip + department.Ship.Extension;
                    Address += fileName;
                    xrPictureBox1.ImageUrl = Address;
                }
                catch { }
            }
        }

    }
}
